package echecs;

import iechecs.type.Liste;

public abstract class Pred {

    public Case _case;
    public Regle R;
    public APiece p,  piece;
    public Position position;
    public Liste<Coups> ListeCoups;
    public Direction d = Direction.Init;
    public Direction dC = Direction.Cavalier;

    public Pred() {
    }

    public boolean isTypeNCaseDTF() {
        return p.regletype.isTypeNCaseDTF();
    }

    public boolean predicat(Case c, Position position) {
        return position.isCaseVide(c);
    }

    public boolean predicat(Case c1, Case c2) {
        return !c1.equals(c2);
    }

    public boolean predicat(APiece p1, APiece p2) {
        return p1.getClass().isInstance(p2);
    }

    public boolean predicat(Direction d1, Direction d2) {
        return !d1.equals(d2);
    }

    public void increment() {
        d = d.next();
    }

    public void sC() {
        dC = dC.next();
    }

    public boolean n(Direction dir) {
        R = new Regle(_case, p);
        R.direction(dir);
        test();
        return true;
    }

    public abstract boolean fclos();

    public abstract boolean tclos();

    public abstract boolean test();
}
